//
//  DetailModel.m
//  jingdongfang
//
//  Created by 郝志宇 on 16/9/8.
//  Copyright © 2016年 ZhiYu Hao. All rights reserved.
//

#import "MessageModel.h"

@implementation MessageModel

+ (MessageModel *)convertFrom:(ImMsgDetail *)msgDetail {
    MessageModel *model = [[MessageModel alloc] init];
    model.type = [msgDetail.type integerValue];
    model.u_id = msgDetail.senderId;
    model.name = msgDetail.senderNick;
    model.image = msgDetail.senderImg;
    model.title = msgDetail.content;
    model.created_at = msgDetail.createAt;
    model.imgSmall = msgDetail.imgSmall;
    if ([model.u_id isEqualToString:[IGUser getUid]]) {
        model.messageType = MessageType_SEND;
    } else {
        model.messageType = MessageType_RECEIVE;
    }
    
    return model;
}

@end
